RFR: 8240110: Improve NULL
David Holmes
david.holmes at oracle.com
Sun Apr 19 22:13:37 UTC 2020
On 20/04/2020 3:08 am, Leo Korinth wrote:
>
>
> On 17/04/2020 08:45, David Holmes wrote:
>> Hi Leo,
>>
>> I've taken a look at the complete set of changes and the only thing I
>> strongly object to is the change to:
>>
>> src/hotspot/share/jvmci/jvmciExceptions.hpp
>>
>> as it just doesn't make any sense to me. If you were to write the
>> expanded macros out in full you would write the code as it currently
>> is defined in the macro. If a method returns a pointer you would write:
>>
>> return NULL;
>>
>> If a method returns a jint/jbyte/jlong etc you would write
>>
>> return 0;
>>
>> Cheers,
>> David
>
> I totally agree with you and the change needed was smaller than I
> rememberd, I should have fixed this directly. Returning NULL for an
> object that is not of pointer type seems just wrong, but returning a
> JVMCIObjectArray(NULL) seems okay.
>
> What about this?
>
> #define JVMCI_CHECK_0 JVMCI_CHECK_(NULL_WORD)
Why does this integer returning macro need to return NULL_WORD? As I
said above if writing this directly I would write "return 0;" in the
code. Is this just an attempt under the covers to (eventually) avoid
misusing JVMCI_CHECK_0 where JVMCI_CHECK_NULL should have been used?
> #define JVMCI_CHECK_NULL JVMCI_CHECK_(NULL)
>
> and 3 changes of JVMCI_CHECK_NULL to JVMCI_CHECK_(JVMCIObjectArray(NULL))
I'm not sure specifically where those changes are.
In general I think I prefer to see an explicit constructor passed NULL
rather than some implicit conversion, but that is a stylistic matter and
the implicit conversion form seems to be used quite extensively.
Thanks,
David
> (this change is so that we get one conversion less)
>
> Thanks,
> Leo
>
>
More information about the hotspot-dev
mailing list