comparing this to NULL in HS - code - was : 8208604: Metadata::print_value_string() compares 'this' to NULL
Baesken, Matthias
matthias.baesken at sap.com
Tue Aug 7 10:46:34 UTC 2018
Hello,
seems we have still quite a few places in the HS C++ codebase where "this" is compared to NULL.
Recently 8208604: Metadata::print_value_string() compares 'this' to NULL :
https://bugs.openjdk.java.net/browse/JDK-8208604
fixed one place and stated :
"The compiler is free to elide this test, since (this == NULL) can never be true; applying an ordinary member function to NULL invokes undefined behavior. "
Should we change the other checks as well ?
Thanks, Matthias
I found these checks :
jdk/src/hotspot/share/adlc/formssel.cpp
1727bool Opcode::print_opcode(FILE *fp, Opcode::opcode_type desired_opcode) {
1728 // Default values previously provided by MachNode::primary()...
1729 const char *description = NULL;
1730 const char *value = NULL;
1731 // Check if user provided any opcode definitions
1732 if( this != NULL ) {
3417void MatchNode::count_instr_names( Dict &names ) {
3418 if( this == NULL ) return;
jdk/src/hotspot/share/opto/chaitin.cpp
2147char *PhaseChaitin::dump_register( const Node *n, char *buf ) const {
2148 if( this == NULL ) { // Not got anything?
2149 sprintf(buf,"N%d",n->_idx); // Then use Node index
2150 } else if( _node_regs ) {
jdk/src/hotspot/share/asm/codeBuffer.cpp
1241void CodeBuffer::print() {
1242 if (this == NULL) {
1243 tty->print_cr("NULL CodeBuffer pointer");
jdk/src/hotspot/share/runtime/perfData.cpp
593PerfData* PerfDataList::find_by_name(const char* name) {
594
595 // if add_item hasn't been called the list won't be initialized
596 if (this == NULL)
597 return NULL;
jdk/src/hotspot/share/libadt/set.cpp
58char *Set::setstr() const
59{
60 if( this == NULL ) return os::strdup("{no set}");
jdk/src/hotspot/share/oops/symbol.cpp
295void Symbol::print_on(outputStream* st) const {
296 if (this == NULL) {
297 st->print_cr("NULL");
308void Symbol::print_value_on(outputStream* st) const {
309 if (this == NULL) {
310 st->print("NULL");
More information about the hotspot-dev
mailing list