RFR: 8227633: avoid comparing this pointers to NULL
Baesken, Matthias
matthias.baesken at sap.com
Fri Jul 12 13:01:31 UTC 2019
>
> + 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
> ------------------------------
>
> Message: 4
> Date: Fri, 12 Jul 2019 08:48:45 -0400
> From: coleen.phillimore at oracle.com
> To: hotspot-dev at openjdk.java.net
> Subject: Re: RFR: 8227633: avoid comparing this pointers to NULL - was
> : RE: this-pointer NULL-checks in hotspot codebase
> [-Wtautological-undefined-compare]
> Message-ID: <ee161209-5dcd-fd7d-02cf-30cb5413c785 at oracle.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
>
> http://cr.openjdk.java.net/~mbaesken/webrevs/8227633.0/src/hotspot/sha
> re/adlc/formssel.cpp.udiff.html
>
> + if (mnode) mnode->count_instr_names(names);
>
>
> We also try to avoid implicit checks against null for pointers so change
> this to:
>
> + if (mnode != NULL) mnode->count_instr_names(names);
>
> 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?
>
> We've done a few passes to clean up these this == NULL checks. Thank you
> for doing this!
>
> Coleen
>
>
More information about the hotspot-dev
mailing list