RFR: JDK-8301493: Replace NULL with nullptr in cpu/aarch64

Johan Sjölen jsjolen at openjdk.org
Mon Feb 6 10:22:53 UTC 2023


On Tue, 31 Jan 2023 11:39:27 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory cpu/aarch64. 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!

Some simple fixes here

src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp line 174:

> 172:   // Then we could use the assert below. However this assert is of somewhat dubious
> 173:   // value.
> 174:   // assert(_pc != null, "no pc?");

nullptr

src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp line 162:

> 160:   // Calling the runtime using the regular call_VM_leaf mechanism generates
> 161:   // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
> 162:   // that checks that the *(rfp+frame::interpreter_frame_last_sp) == null.

nullptr

src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp line 160:

> 158:   // Calling the runtime using the regular call_VM_leaf mechanism generates
> 159:   // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
> 160:   // that checks that the *(rfp+frame::interpreter_frame_last_sp) == null.

nullptr

src/hotspot/cpu/aarch64/icBuffer_aarch64.cpp line 50:

> 48:   // (1) the value is old (i.e., doesn't matter for scavenges)
> 49:   // (2) these ICStubs are removed *before* a GC happens, so the roots disappear
> 50:   // assert(cached_value == null || cached_oop->is_perm(), "must be perm oop");

nullptr

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp line 143:

> 141:     Label L;
> 142:     ldr(rscratch1, Address(rthread, JavaThread::jvmti_thread_state_offset()));
> 143:     cbz(rscratch1, L); // if (thread->jvmti_thread_state() == null) exit;

nullptr

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp line 1313:

> 1311: //       if (row[2].rec == rec) { row[2].incr(); goto done; }
> 1312: //       if (row[2].rec != null) { count.incr(); goto done; } // overflow
> 1313: //       row[2].init(rec); goto done;

nullptr

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp line 1586:

> 1584:     cbz(rscratch1, L);
> 1585:     stop("InterpreterMacroAssembler::call_VM_leaf_base:"
> 1586:          " last_sp != null");

nullptr

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp line 1614:

> 1612:     cbz(rscratch1, L);
> 1613:     stop("InterpreterMacroAssembler::call_VM_base:"
> 1614:          " last_sp != null");

nullptr

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1158:

> 1156:   }
> 1157: 
> 1158:   // for (scan = klass->itable(); scan->interface() != null; scan += scan_step) {

nullptr

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 4791:

> 4789: 
> 4790:   if (UseSimpleArrayEquals) {
> 4791:     Label NEXT_WORD, SHORT, TAIL03, TAIL01, A_MIGHT_BE_nullptr, A_IS_NOT_NULL;

Fix this macro

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 2059:

> 2057:     __ tbnz(src_pos, 31, L_failed);  // i.e. sign bit set
> 2058: 
> 2059:     //  if (dst == null) return -1;

nullptr

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 2077:

> 2075: #ifdef ASSERT
> 2076:     //  assert(src->klass() != null);
> 2077:     {

nullptr

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp line 3698:

> 3696:   __ bind(done);
> 3697:   // r0 = 0: obj == NULL or  obj is not an instanceof the specified klass
> 3698:   // r0 = 1: obj != NULL and obj is     an instanceof the specified klass

nullptr

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

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


More information about the shenandoah-dev mailing list