-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8302189: Mark assertion failures noreturn #12845
Conversation
👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into |
@kimbarrett |
@kimbarrett The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
@kimbarrett Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
Webrevs
|
@@ -100,7 +100,7 @@ endif | |||
|
|||
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value | |||
|
|||
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 4127 | |||
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 4127 4722 |
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.
I forgot to mention this in the PR summary. New warning suppression for
4722: 'function' : destructor never returns, potential memory leak
We have various destructors calling ShouldNotCallThis, ShouldNotReachHere,
or the like, which triggers this warning. It might be possible to deal with
some (but not all) of those by deleting the destructor. The warning doesn't
seem all that useful to us, so I just suppressed 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.
A few initial comments while I try to digest this.
I don't use these particular debugging mechanism, neither Debugger nor BREAKPOINT, but it seems potentially problematic to me that the removed BREAKPOINTs happened after the error was reported, and IIUC the new mechanism will activate before the error is reported.
Thanks.
@@ -100,7 +100,7 @@ endif | |||
|
|||
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value | |||
|
|||
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 4127 | |||
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 4127 4722 |
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 is annoying that we don't document what these warnings are. :(
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.
I've made the same comment in the past. This time I decided to do something about it:
https://bugs.openjdk.org/browse/JDK-8303618
Document disabled C/C++ warnings on Windows
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.
Looks like something I can help with, will assign the enhancement to myself
ResourceMark rm; | ||
bool debug_save; | ||
ResourceMark _rm; | ||
DebuggingContext _debugging; |
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.
Why a different initialization syntax here?
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.
I don't understand the question? These are member variable declarations.
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.
I believe David is asking about why these particular member names were changed
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.
No I'm comparing the syntax used elsewhere:
DebuggingContext debugging{};
with that used here:
DebuggingContext debugging;
why the braces in most cases but not here?
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.
"syntax used elsewhere" are declarations of local variables initialized with value initialization (which is default initialization for this type). "that used here" is a member variable declaration in the Command class, where the initialization occurs elsewhere (in the constructor of the Command class [*]). They are entirely different syntactic entities. Does that help? Or am I still not understanding your question?
[*] With C++11, data members can have default initializers, but that's not an approved feature for HotSpot.
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.
Sorry I was fixated on the weirdness (to me) of the {} initialization. I missed the fact these were different kinds of declarations.
if (is_enabled()) { | ||
fatal("Multiple Debugging contexts"); | ||
} |
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.
This seems too restrictive as you could hit different DebuggingContexts in different threads. ??
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.
This facility is only intended for use by manually invoked commands while the program is stopped in a debugger. Multi-threaded use is not an issue (and was not supported previously either). I don't think there are any nested uses either, but I've now run across a couple of places where nesting could be useful. So I'm changing the state from a simple bool to a nesting counter.
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.
Okay I hadn't realized the process was basically "suspended" when this was activated - as I said I never use this stuff.
The removed BREAKPOINTs were not happening after the error was reported. |
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.
Okay other than the one outstanding minor syntax query, I have nothing further to add.
Thanks.
@kimbarrett This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
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.
Seems fine. I'll test drive with the debug commands next time I need to use them but this is similar to to the changes I have in my private repos. Thanks for keeping this functionality.
// constant evaluation in the compiler. We don't do something like that now, | ||
// because we need a fallback when we don't have any mechanism for detecting | ||
// constant evaluation. | ||
#if defined(TARGET_COMPILER_gcc) || defined(TARGET_COMPILER_xlc) |
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.
All this seems like it should go in COMPILER_HEADER(globalDefinitions.hpp) but since globalDefinitions.hpp includes debug.hpp, you can't do this. Can we file an RFE to clean this up (if possible)?
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.
I considered that, and had two reasons for rejecting it.
The include ordering problem was one. There are uses of assert and the like in
globalDefinitions. Some of those might someday be moved elsewhere, but for now
the order is a problem.
The other is that this is really not "general purpose", but rather very
specifically tailored to the use here. And it can't be general purpose,
because there isn't a general fallback for testing for constexpr evaluation.
I could have added HAS_IS_CONSTANT_EVALUATED
and ::is_constant_evaluated()
,
with all uses of the latter requiring protection by the former. But I couldn't
think of any places where I would want to use that. Using it in, for example,
count_trailing_zeros to allow it to be (sometimes) constexpr would make the
question of whether it's constexpr be platform-dependent, which means it can't
be used in shared required constexpr contexts. And it's even worse since the
platform dependency is also currently compiler version dependent. I think that
path leads nowhere good.
However, I've filed this cleanup RFE:
https://bugs.openjdk.org/browse/JDK-8303797
Thanks for reviews @dholmes-ora and @coleenp |
/integrate |
Going to push as commit 5fa9bd4. |
@kimbarrett Pushed as commit 5fa9bd4. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Also 8302799: Refactor Debugging variable usage for noreturn crash reporting
/issue add JDK-8302799
Please review this change to make the functions used to report assertion
failures and the like be noreturn, and mark them as such for the compiler
using the [[noreturn]] attribute.
These functions were returning if the
Debugging
variable was true, and mustnot do so anymore.
We introduce a new mechanism for temporarily disabling assertions while
calling certain "debugging" commands while stopped in a debugger:
DebuggingContext. This replaces the
Debugging
variable.To disable assertions when in a debugging context the various checking macros
now also check for the context. This ends up being a bit complicated and
messy. See discussion in debug.hpp.
Only error reporting under the control of ASSERT is affected by the debugging
context. Others seem much less likely to be survivable. Explicit debugging
checks can be added where needed to support the debugging commands. A few
are included with this change. There might be more needed; I haven't
exhaustively tested the debugging commands.
In some respects it would be better to not have assertions be automatically
disabled by DebuggingContext, and instead use explicit context checks where
needed. The problem is that "where needed" is a difficult to determine and
maintain set.
Testing:
mach5 tier1-7
Manually tested some of the debugging commands.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12845/head:pull/12845
$ git checkout pull/12845
Update a local copy of the PR:
$ git checkout pull/12845
$ git pull https://git.openjdk.org/jdk pull/12845/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12845
View PR using the GUI difftool:
$ git pr show -t 12845
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12845.diff