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
8299974: Replace NULL with nullptr in share/adlc/ #14008
Conversation
👋 Welcome back jsjolen! A progress list of the required criteria for merging this PR into |
@jdksjolen The following label 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 list. If you would like to change these labels, use the /label pull request command. |
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 alignment and comment issues.
src/hotspot/share/adlc/adlArena.cpp
Outdated
@@ -53,7 +53,7 @@ void AdlChunk::operator delete(void* p, size_t length) { | |||
} | |||
|
|||
AdlChunk::AdlChunk(size_t length) { | |||
_next = NULL; // Chain on the linked list | |||
_next = nullptr; // Chain on the linked 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.
Align
_first = _chunk = NULL; // Normal, new-arena initialization | ||
_hwm = _max = NULL; | ||
_first = _chunk = nullptr; // Normal, new-arena initialization | ||
_hwm = _max = nullptr; |
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.
Align
src/hotspot/share/adlc/adlparse.cpp
Outdated
char *pType = NULL; // parameter type | ||
char *pName = NULL; // parameter name | ||
char *pType = nullptr; // parameter type | ||
char *pName = nullptr; // parameter name |
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.
Align?
src/hotspot/share/adlc/adlparse.cpp
Outdated
@@ -970,7 +970,7 @@ void ADLParser::enc_class_parse_block(EncClass* encoding, char* ec_name) { | |||
//------------------------------frame_parse----------------------------------- | |||
void ADLParser::frame_parse(void) { | |||
FrameForm *frame; // Information about stack-frame layout | |||
char *desc = NULL; // String representation of frame | |||
char *desc = nullptr; // String representation of frame |
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.
align
src/hotspot/share/adlc/adlparse.cpp
Outdated
parse_err(SYNERR, "missing frame pointer definition in frame section.\n"); | ||
return; | ||
} | ||
// !!!!! !!!!! | ||
// if(frame->_interpreter_frame_ptr_reg == NULL) { | ||
// if(frame->_interpreter_frame_ptr_reg == null) { |
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.
nullptr
src/hotspot/share/adlc/formssel.cpp
Outdated
@@ -2944,7 +2944,7 @@ ComponentList::ComponentList() : NameList(), _matchcnt(0) { | |||
ComponentList::~ComponentList() { | |||
// // This list may not own its elements if copied via assignment | |||
// Component *component; | |||
// for (reset(); (component = iter()) != NULL;) { | |||
// for (reset(); (component = iter()) != null;) { |
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.
nullptr
src/hotspot/share/adlc/formssel.cpp
Outdated
@@ -3382,13 +3382,13 @@ const char *MatchNode::reduce_right(FormDict &globals) const { | |||
rightStr = mnode->_rChild->_internalop ? mnode->_rChild->_internalop | |||
: mnode->_rChild->_opType; | |||
} | |||
// Else, May be simple chain rule: (Set dst operand_form), rightStr=NULL; | |||
// Else, May be simple chain rule: (Set dst operand_form), rightStr=null; |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
// MachNode *inst0 = NULL; | ||
// MachNode *inst0 = null; | ||
// ... | ||
// MachNode *instMAX = NULL; | ||
// MachNode *instMAX = null; | ||
// |
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.
nullptr
src/hotspot/share/adlc/output_h.cpp
Outdated
@@ -580,7 +580,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_ | |||
// Default formats for base operands (RegI, RegP, ConI, ConP, ...) | |||
oper.ext_format(fp, globals, 0); | |||
} | |||
} else { // oper._format == NULL | |||
} else { // oper._format == null |
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 null
src/hotspot/share/adlc/output_h.cpp
Outdated
@@ -1112,7 +1112,7 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) { | |||
fprintf(fp_hpp, "};\n\n"); | |||
|
|||
// const char *classname; | |||
// for (_pipeline->_classlist.reset(); (classname = _pipeline->_classlist.iter()) != NULL; ) { | |||
// for (_pipeline->_classlist.reset(); (classname = _pipeline->_classlist.iter()) != null; ) { |
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.
nullptr
Hm. I think that this is completely broken. This is a compiler/code generation tool so any string containing |
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.
Found all (most?) of the faulty NULL -> null conversions.
src/hotspot/share/adlc/dfa.cpp
Outdated
// child should be NULL, to distinguish from the predicated version. | ||
fprintf(fp, " && _kids[1] == NULL"); | ||
// child should be null, to distinguish from the predicated version. | ||
fprintf(fp, " && _kids[1] == null"); |
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.
nullptr
src/hotspot/share/adlc/dfa.cpp
Outdated
printf("%s", (_result == null ? "null" : _result ) ); | ||
printf("%s", (_constraint == null ? "null" : _constraint ) ); | ||
printf("%s", (_valid == null ? "null" : _valid ) ); |
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.
nullptr
src/hotspot/share/adlc/formssel.cpp
Outdated
const char* opType = _matrule->_opType; | ||
if (strcmp(opType, "Set")==0) | ||
opType = _matrule->_rChild->_opType; | ||
if (strcmp(opType,"ThreadLocal")==0) { | ||
fprintf(stderr, "Warning: ThreadLocal instruction %s should be named 'tlsLoadP_*'\n", | ||
(_ident == NULL ? "NULL" : _ident)); | ||
(_ident == nullptr ? "null" : _ident)); |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
fprintf(fp_cpp, "static const Pipeline pipeline_class_Zero_Instructions(0, 0, true, 0, 0, false, false, false, false, null, null, null, Pipeline_Use(0, 0, 0, null));\n\n"); | ||
fprintf(fp_cpp, "static const Pipeline pipeline_class_Unknown_Instructions(0, 0, true, 0, 0, false, true, true, false, null, null, null, Pipeline_Use(0, 0, 0, null));\n\n"); | ||
|
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
@@ -889,7 +889,7 @@ void ArchDesc::build_pipe_classes(FILE *fp_cpp) { | |||
pipeline_reads_index+1); | |||
} | |||
else | |||
fprintf(fp_cpp, " NULL,"); | |||
fprintf(fp_cpp, " null,"); |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*s::pipeline_class() { return %s; }\n", | ||
max_ident_len, "Node", _pipeline ? "(&pipeline_class_Zero_Instructions)" : "NULL"); | ||
max_ident_len, "Node", _pipeline ? "(&pipeline_class_Zero_Instructions)" : "null"); | ||
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*s::pipeline() const { return %s; }\n", | ||
max_ident_len, "Node", _pipeline ? "(&pipeline_class_Zero_Instructions)" : "NULL"); | ||
max_ident_len, "Node", _pipeline ? "(&pipeline_class_Zero_Instructions)" : "null"); | ||
fprintf(_CPP_PIPELINE_file._fp, "\n"); | ||
|
||
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*s::pipeline_class() { return %s; }\n", | ||
max_ident_len, "MachNode", _pipeline ? "(&pipeline_class_Unknown_Instructions)" : "NULL"); | ||
max_ident_len, "MachNode", _pipeline ? "(&pipeline_class_Unknown_Instructions)" : "null"); | ||
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*s::pipeline() const { return pipeline_class(); }\n", |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
const char *opEnumName = machOperEnum(iopn); | ||
// Generate the case statement for this opcode | ||
fprintf(fp_cpp, " case %s:", opEnumName); | ||
fprintf(fp_cpp, " return NULL;\n"); | ||
fprintf(fp_cpp, " return null;\n"); |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
@@ -3912,15 +3912,15 @@ void ArchDesc::buildMachOperGenerator(FILE *fp_cpp) { | |||
fprintf(fp_cpp, " }\n"); | |||
|
|||
// Generate the closing for method Matcher::MachOperGenerator | |||
fprintf(fp_cpp, " return NULL;\n"); | |||
fprintf(fp_cpp, " return null;\n"); |
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.
nullptr
src/hotspot/share/adlc/output_c.cpp
Outdated
@@ -4171,7 +4171,7 @@ void ArchDesc::buildMachNodeGenerator(FILE *fp_cpp) { | |||
fprintf(fp_cpp, " };\n"); | |||
|
|||
// Generate the closing for method Matcher::MachNodeGenerator | |||
fprintf(fp_cpp, " return NULL;\n"); | |||
fprintf(fp_cpp, " return null;\n"); |
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.
nullptr
src/hotspot/share/adlc/output_h.cpp
Outdated
@@ -712,7 +712,7 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c | |||
} | |||
else if( inst.is_ideal_mem() ) { | |||
// Print out the field name if available to improve readability | |||
fprintf(fp, " if (ra->C->alias_type(adr_type())->field() != NULL) {\n"); | |||
fprintf(fp, " if (ra->C->alias_type(adr_type())->field() != null) {\n"); |
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.
nullptr
@jdksjolen this pull request can not be integrated into git checkout JDK-8299974
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Builds on linux-x64, running tier1. Open for review. |
Webrevs
|
@@ -85,9 +85,9 @@ void ChainList::dump() { | |||
|
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.
Missing copyright year update.
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 good, except I found one missing copyright update.
@jdksjolen 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 36 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 |
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 have few comments
src/hotspot/share/adlc/adlparse.cpp
Outdated
if( _curline == nullptr ) // Return null at EOF. | ||
return nullptr; |
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.
Spacing of comment. Please, fix code style to:
if (_curline == nullptr) { // Return null at EOF.
return nullptr;
}
src/hotspot/share/adlc/adlparse.cpp
Outdated
} | ||
_ptr = end; // Reset _ptr to point to next char after token | ||
|
||
// Make sure we do not try to use #defined identifiers. If start is | ||
// NULL an error was already reported. | ||
if (do_preproc && start != NULL) { | ||
// null an error was already 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.
May be use nullptr
here since we are talking about value in start
variable.
src/hotspot/share/adlc/adlparse.cpp
Outdated
if( _curline == nullptr ) // Return null at EOF. | ||
return 0; |
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.
Code style.
src/hotspot/share/adlc/adlparse.cpp
Outdated
if( _curline == nullptr ) // Return null at EOF. | ||
return nullptr; |
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.
Code style.
src/hotspot/share/adlc/adlparse.cpp
Outdated
if( _curline != nullptr ) // at end of file _curchar isn't valid | ||
_curchar = *_ptr; // reset _curchar to maintain invariant |
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.
Code style.
Fixed! Thank you. |
May be I was not clear. I asked to add missing |
Error doesn't seem relevant to this change (has to do with vector incubator). |
Aha, I only saw the spaces issues (and not even all of those). Please have a look now. |
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 good now.
I'm integrating this. Only test failure on GHA seems entirely unrelated to this changeset. /integrate |
Going to push as commit 62537d2.
Your commit was automatically rebased without conflicts. |
@jdksjolen Pushed as commit 62537d2. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/adlc. Unfortunately the script that does the change isn't perfect, and so we need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
Here are some typical things to look out for:
An example of this:
Note how
nullptr
participates in a code expression here, we really are talking about the specific valuenullptr
.Thanks!
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14008/head:pull/14008
$ git checkout pull/14008
Update a local copy of the PR:
$ git checkout pull/14008
$ git pull https://git.openjdk.org/jdk.git pull/14008/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14008
View PR using the GUI difftool:
$ git pr show -t 14008
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14008.diff
Webrev
Link to Webrev Comment