RFR: 8227633: avoid comparing this pointers to NULL
Baesken, Matthias
matthias.baesken at sap.com
Tue Jul 16 13:01:21 UTC 2019
Hello Coleen ,
I adjusted the check in formssel.cpp to if (mnode != NULL) ,
> > I didn't see that you added a check for NULL in the callers of
> > print_opcodes
and added NULL checks to the _inst._opcode->print_opcode calls in src/hotspot/share/adlc/output_c.cpp .
Regarding Set::setstr() in src/hotspot/share/libadt/set.cpp ,
This is used in print() and this can be called "conveniently in the debugger" (see set.hpp ).
So I think it is okay to remove the check .
please see the new webrev :
http://cr.openjdk.java.net/~mbaesken/webrevs/8227633.2/
Thanks, Matthias
>
> >
> > + if (mnode) mnode->count_instr_names(names);
> >
> >
> > We also try to avoid implicit checks against null for pointers so change
> > this to:
> >
>
> Hi Coleen, sure I can change this ; I just found a lot of places in formssel.cpp
> where if (ptr) { ... } is used .
>
> >
> > I didn't see that you added a check for NULL in the callers of
> > print_opcodes or setstr.? Can those callers never pass NULL?
> >
>
> It looked to me that the setstr is never really called and void Set::print()
> const { ... } where it is used is used for debug printing - did I miss something
> ?
>
> Regarding print_opcodes , there probably the NULL checks at caller palces
> should better be added .
>
> Regards, Matthias
>
More information about the hotspot-dev
mailing list