RFR: JDK-8301072: Replace NULL with nullptr in share/oops/

Johan Sjölen jsjolen at openjdk.org
Thu Jan 26 16:31:20 UTC 2023


On Wed, 25 Jan 2023 11:46:23 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/oops/. Unfortunately the script that does the change isn't perfect, and so we
> need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
> 
> Here are some typical things to look out for:
> 
> 1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
> 2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
> 3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in a comment.
> 
> An example of this:
> 
> ```c++
> // This function returns null
> void* ret_null();
> // This function returns true if *x == nullptr
> bool is_nullptr(void** x);
> 
> 
> Note how `nullptr` participates in a code expression here, we really are talking about the specific value `nullptr`.
> 
> Thanks!

Found some manual fixes

Passes tier1.

src/hotspot/share/oops/annotations.cpp line 84:

> 82:   it->push(&_fields_annotations);
> 83:   it->push(&_class_type_annotations);
> 84:   it->push(&_fields_type_annotations); // FIXME: need a test case where _fields_type_annotations != null

nullptr

src/hotspot/share/oops/instanceKlass.cpp line 114:

> 112: #define DTRACE_CLASSINIT_PROBE(type, thread_type)                \
> 113:   {                                                              \
> 114:     char* data = nullptr;                                           \

align

src/hotspot/share/oops/method.cpp line 1617:

> 1615: 
> 1616: vmSymbolID Method::klass_id_for_intrinsics(const Klass* holder) {
> 1617:   // if loader is not the default loader (i.e., != null), we can't know the intrinsics

non-null

-------------

PR: https://git.openjdk.org/jdk/pull/12186


More information about the hotspot-dev mailing list