-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: implement per-process native Debug() printer and use it in mkcodecache #31884
Conversation
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment.
This patch adds a per-process native Debug() printer that can be called when an Environment is not available.
src/env.h
Outdated
bool debug_enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = { | ||
false}; | ||
|
||
std::unique_ptr<EnabledDebugList> enabled_debug_list_; |
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.
Is there any reason that this would need to be a pointer? I don’t think that’s necessary, and it comes with one additional layer of indirection for each debug check. One of the goals for the Debug() implementation was to have as close to zero overhead as possible, and I think this might get in the way of it…
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.
Mostly to avoid the circular dependency - but I guess this can also be achieved by moving more things from debug_utils.h
to debug_utils-inl.h
so that env.h
can just include debug_utils.h
and debug_utils.h
do not need to include env.h
?
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.
If that works, then that would be great – otherwise we might need to move more things into env.h
…
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.
hmm, looks like if we want to keep the initialization in the constructor, then it needs to be a pointer since we'd need the environment pointer with initialized env_vars for credentials::SafeGetenv()
. So I just moved the initialization into EnableDebugList::Parse()
, and call it in InitializeOncePerProcess
(and separately, in mkcodecache since it does not need InitializeOncePerProcess()
), this also means that for now the printer is not usable until node::Start()
is called in the default binary, but I guess that's fine, compared to reordering the whole initialization sequence to work around pointers.
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.
Fwiw, what I had in mind is to use the trivial copy constructor to re-initialize it later, e.g. enabled_debug_list_ = EnabledDebugList(...);
, but I guess ::Parse()
works just as well :)
@@ -1225,6 +1225,16 @@ | |||
], | |||
|
|||
'conditions': [ | |||
[ 'node_use_openssl=="true"', { |
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.
Just realized that these are necessary for the headers (esp. enums) to match in mkcodecache and node_mksnapshot binaries - hopefully all these cruft can be cleaned up when #31074 is addressed, though the last time I tried SmartOS wouldn't link, sigh.
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch adds a per-process native Debug() printer that can be called when an Environment is not available. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in bb6125b...192cb72, thanks! For posterity - if you encounter linking issues after this patch please re-run configure as this patch has changed the build flags of mkcodecache and mksnapshot |
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch adds a per-process native Debug() printer that can be called when an Environment is not available. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch adds a per-process native Debug() printer that can be called when an Environment is not available. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch adds a per-process native Debug() printer that can be called when an Environment is not available. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented in util-inl.h PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Move the debug category parsing into a new EnabledDebugList class, so that it can be reused outside of Environment. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch adds a per-process native Debug() printer that can be called when an Environment is not available. PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #31884 Reviewed-By: Anna Henningsen <anna@addaleax.net>
src: make aliased_buffer.h self-contained
aliased_buffer.h uses MultiplyWithOverflowCheck() implemented
in util-inl.h
src: refactor debug category parsing
Move the debug category parsing into a new EnabledDebugList class,
so that it can be reused outside of Environment.
src: implement per-process native Debug() printer
This patch adds a per-process native Debug() printer that can be
called when an Environment is not available.
tools: use per-process native Debug() printer in mkcodecache
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes