RFR: 8240110: Improve NULL

Leo Korinth leo.korinth at oracle.com
Sun Apr 19 17:08:09 UTC 2020



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)
#define JVMCI_CHECK_NULL          JVMCI_CHECK_(NULL)

and 3 changes of JVMCI_CHECK_NULL to JVMCI_CHECK_(JVMCIObjectArray(NULL))

(this change is so that we get one conversion less)

Thanks,
Leo




More information about the hotspot-dev mailing list