RFR: 8227633: avoid comparing this pointers to NULL

dean.long at oracle.com dean.long at oracle.com
Thu Jul 18 06:26:14 UTC 2019


The adlc changes look OK.

dl

On 7/16/19 8:30 AM, coleen.phillimore at oracle.com wrote:
>
> This looks good to me.  I don't know this compiler code very well, so 
> please wait for a second reviewer.
> Thanks,
> Coleen
>
> On 7/16/19 9:01 AM, Baesken, Matthias wrote:
>> 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