JDK-8318671: Potential uninitialized uintx value after JDK-8317683#16335
JDK-8318671: Potential uninitialized uintx value after JDK-8317683#16335tstuefe wants to merge 7 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
|
@tstuefe 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. |
Webrevs
|
| jio_snprintf(errorbuf, buf_size, "MemStat: invalid value expected 'collect' or 'print' (omitting value means 'collect')"); | ||
| return handled_err; |
There was a problem hiding this comment.
If "omitting value means 'collect'" then why do we not simply set value = (uintx)MemStatAction::collect ? Otherwise what is that message supposed to mean?
Ternary return values are unpleasant.
There was a problem hiding this comment.
If "omitting value means 'collect'" then why do we not simply set value = (uintx)MemStatAction::collect ? Otherwise what is that message supposed to mean?
We only enter this function if a value for this command had been given (-XX:CompileCommand=<command>,<method>[,<value>]). The default case is handled somewhere else (CompilerOracle::parse_from_line).
Ternary return values are unpleasant.
As, on a general base? You don't like the number three :-) ?
Here, we have to distinguish between:
- not handled, its not a command option that accepts enum strings
- handled, with two variants: handled, had an error, and handled, had no error. Only in the latter case we want to register the command.
There was a problem hiding this comment.
Okay I'll butt out. The comment doesn't make sense to me.
There was a problem hiding this comment.
@dholmes-ora Sorry if I came across as flippant; that was not my intention. If you can stomach it, I rewrote the patch to be hopefully easier to read. Thanks.
There was a problem hiding this comment.
No I didn't take it that way at all. The new patch does seem easier to read, but I will still defer to compiler folk to review this.
…d-uintx-value-after-JDK-8317683
| * java.management | ||
| * @run main/othervm -XX:CompileCommand=memstat,*.*,collect CompilerMemoryStatisticTest | ||
| */ | ||
|
|
There was a problem hiding this comment.
Reviewer hint: Removed because its redundant with the syntax check introduced in MemStatTest.java
jdksjolen
left a comment
There was a problem hiding this comment.
Hi,
This looks good to me, I've got a couple of comments (one is just a nit). I'll leave it to the compiler folks for approval.
|
@tstuefe 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 37 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
I think this is ready for integration given that both @dholmes-ora and @jdksjolen are okay with it. |
…value-after-JDK-8317683
Well, they did not approve yet; @jdksjolen or @dholmes-ora, if you are happy with this, could you hit the big green button please? |
|
@TobiHartmann both @jdksjolen and myself indicated we would defer to the compiler team to review/approve this. I only had some drive-by comments. |
|
@shipilev maybe, as bug owner? |
| total_bytes_read += bytes_read; | ||
| line += bytes_read; | ||
| register_command(matcher, option, value); | ||
| return; |
There was a problem hiding this comment.
Why this return removed? All other cases in this file have the return after register_command, which I assume the style here: once any command is properly matched, return.
| static bool parseEnumValueAsUintx(enum CompileCommand option, const char* line, uintx& value, int& bytes_read, char* errorbuf, const int buf_size) { | ||
| // Parse an uintx-based option value. Also takes care of parsing enum values for options that are enums. | ||
| // Returns true if ok, false if the value could not be parsed. | ||
| static bool parseUintxValue(enum CompileCommand option, const char* line, uintx& value, int& bytes_read) { |
There was a problem hiding this comment.
It is honestly weird to see parse***Uintx***Value dealing with enums, and be specialized for MemStat. Can you reflow this to match how MemLimit does it?
There was a problem hiding this comment.
Okay, rewritten in the style of #16631. Retested too. Let's get this out of the door, please.
shipilev
left a comment
There was a problem hiding this comment.
All right, new version looks significantly better, thanks!
|
MacOS error unrelated. /integrate |
|
Going to push as commit 2e34a2e.
Your commit was automatically rebased without conflicts. |
When using 'MemStat' CompileCommand, we accidentally register the command if an invalid suboption had been specified. Fixed, added regression test (verified).
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16335/head:pull/16335$ git checkout pull/16335Update a local copy of the PR:
$ git checkout pull/16335$ git pull https://git.openjdk.org/jdk.git pull/16335/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16335View PR using the GUI difftool:
$ git pr show -t 16335Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16335.diff
Webrev
Link to Webrev Comment